package mBio;

import java.io.FileNotFoundException;
import java.io.IOException;

import rfBio.*;

public class clean_fasta {

	public static void main(String[] args)
	 throws IOException, FileNotFoundException{
		

		Bioutil test = new Bioutil();
		
		if(args.length != 3){
			System.out.println("Wrong number of parameters!" + '\n' + "Usage: clean_fasta infile outfile type." + '\n' + "       type is any of p, d or r.");
			System.exit(0);
			
		}
		
		
		if( (args[2].equals("p")) || (args[2].equals("P")) || (args[2].equals("d")) || (args[2].equals("D")) || (args[2].equals("r")) || (args[2].equals("R")) ){
			// type OK
		}
		else{
			System.out.println("Invalide type. Has to be either p,d or r");
			System.exit(0);
		}
		fasta f = new fasta(args[0]);
		
		if( (args[2] == "p") || (args[2] == "P")){
			f.set_type("p");
		}
		if( (args[2] == "d") || (args[2] == "D")){
			f.set_type("d");
		}
		if( (args[2] == "r") || (args[2] == "R")){
			f.set_type("r");
		}
		f.clean();
		f.writeFasta(args[1]);
		
	}

}
